package cn.com.lei.du.service.impl;

import cn.com.lei.du.entity.User;
import cn.com.lei.du.service.UserService;
import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class UserServiceImpl implements UserService {


    @Override
    public User findById(String id) {
        Long current = System.currentTimeMillis();
        if (0==current%2){
            User user = new User();
            user.setId(id);
            user.setName("用户"+(1+Math.random()*1000));
            user.setHeadUrl("http://www.baidu.com");
            user.setPassword(UUID.randomUUID().toString().replace("-",""));
            return user;
        }
        return null;
    }

    @Override
    public User addUser(User user) {
        user.setId(UUID.randomUUID().toString().replace("-",""));
        return user;
    }
}
